﻿@page "/drag-drop"
@inject IStringLocalizer<DragDrops> Localizer

<h3>@Localizer["Title"]</h3>

<h4>@Localizer["Description"]</h4>

<DemoBlock Title="@Localizer["NormalTitle"]" Introduction="@Localizer["NormalIntro"]" Name="Normal">
    <div>
        <Row ItemsPerRow="ItemsPerRow.Two">
            <Dropzone TItem="string" Items="@StrList1">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
            <Dropzone TItem="string" Items="@StrList2">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
        </Row>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["CopyItemTitle"]" Introduction="@Localizer["CopyItemIntro"]" Name="CopyItem">
    <div>
        <Row ItemsPerRow="ItemsPerRow.Two">
            <Dropzone TItem="string" Items="@StrList1">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
            <Dropzone TItem="string" Items="@StrList2" CopyItem="s => new string(s)">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
        </Row>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["AcceptsTitle"]" Introduction="@Localizer["AcceptsIntro"]" Name="Accepts">
    <div>
        <Row ItemsPerRow="ItemsPerRow.Two">
            <Dropzone TItem="string" Items="@StrList1" Accepts="@((s, s1) => s == "10")" AllowsDrag="@(s => s != "2")">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
            <Dropzone TItem="string" Items="@StrList2" MaxItems="6">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
        </Row>
    </div>
</DemoBlock>

<DemoBlock Title="@Localizer["EventTitle"]" Introduction="@Localizer["EventIntro"]" Name="Event">
    <div>
        <Row ItemsPerRow="ItemsPerRow.Two">
            <Dropzone TItem="string" Items="@StrList1" Accepts="@((s, s1) => s == "10")" OnItemDropRejected="@OnItemDropRejected" OnItemDrop="@OnItemDrop" OnReplacedItemDrop="@OnReplacedItemDrop">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
            <Dropzone TItem="string" Items="@StrList2" MaxItems="6" OnItemDropRejectedByMaxItemLimit="@OnItemDropRejectedByMaxItemLimit" OnItemDrop="@OnItemDrop" OnReplacedItemDrop="@OnReplacedItemDrop">
                <Card IsShadow="true">
                    <BodyTemplate>
                        @context
                    </BodyTemplate>
                </Card>
            </Dropzone>
        </Row>
        <ConsoleLogger @ref="Logger" />
    </div>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />

<MethodTable Items="GetMethods()" />
